//===============================================================================
// Microsoft patterns & practices Enterprise Library Contribution
// Validation Application Block
//===============================================================================

using System;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Configuration;
using EntLibContrib.Validation.Validators;

namespace EntLibContrib.Validation.Configuration
{
	/// <summary>
	/// Enum Defined Validator Data
	/// </summary>
	public class EnumDefinedValidatorData : ValueValidatorData
	{
		#region Construction
		/// <summary>
		/// <para>Initializes a new instance of the <see cref="EnumDefinedValidatorData"/> class.</para>
		/// </summary>
		public EnumDefinedValidatorData()
		{ }

		/// <summary>
		/// <para>Initializes a new instance of the <see cref="EnumDefinedValidatorData"/> class with a name.</para>
		/// </summary>
		/// <param name="name">The name for the instance.</param>
		public EnumDefinedValidatorData(string name)
			: base(name, typeof(EnumDefinedValidator))
		{ }
		#endregion

		#region Protected Methods
		/// <summary>
		/// Creates the <see cref="EnumDefinedValidator"/> described by the configuration object.
		/// </summary>
		/// <param name="targetType">The type of object that will be validated by the validator.</param>
		/// <returns>The created <see cref="EnumDefinedValidator"/>.</returns>	
		protected override Validator DoCreateValidator(Type targetType)
		{
			return new EnumDefinedValidator(Negated);
		}
		#endregion
	}
}
